package com.xbts.system.domain;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data;
import com.xbts.common.annotation.Excel;
import com.xbts.common.utils.StringUtils;
import com.xbts.common.core.domain.BaseEntity;

/**
 * 用户认证对象 sys_user_authentication
 *
 * @author xbts
 * @date 2023-10-20
 */
@Data
@ApiModel("用户认证对象")
@TableName("sys_user_authentication")
public class SysUserAuthentication extends BaseEntity {

    private static final long serialVersionUID=1L;

    /** id */
    @TableId
    private String id;

    /** 用户Id */
    @Excel(name = "用户Id")
    @ApiModelProperty("用户Id")
    private String userId;

    /** 凭证地址 */
    @Excel(name = "凭证地址")
    @ApiModelProperty("凭证地址")
    @NotEmpty(message = "凭证地址不能为空")
    private String certificatePath;

    /** 通讯地址 */
    @Excel(name = "通讯地址")
    @ApiModelProperty("通讯地址")
    private String address;

    /** 通讯地址详细地址 */
    @Excel(name = "通讯地址详细地址")
    @ApiModelProperty("通讯地址详细地址")
    private String addressDetail;

    /** 真实姓名 */
    @Excel(name = "真实姓名")
    @ApiModelProperty("真实姓名")
    @NotEmpty(message = "真实姓名不能为空")
    private String realName;

    private String nickName;

    /** 身份证号码/社会统一信用代码 */
    @Excel(name = "身份证号码/社会统一信用代码")
    @ApiModelProperty("身份证号码/社会统一信用代码")
    @NotEmpty(message = "身份证号码/社会统一信用代码不能为空")
    private String number;

    /** 1 待审核，2审核通过，3审核拒绝 */
    @Excel(name = "1 待审核，2审核通过，3审核拒绝")
    @ApiModelProperty("1 待审核，2审核通过，3审核拒绝")
    private Integer status;

    /** 1个人，2企业，3个人转企业 */
    @Excel(name = "1个人，2企业，3个人转企业")
    @ApiModelProperty("1个人，2企业，3个人转企业")
    @NotNull(message = "认证类型不能为空")
    private Integer type;

    /** 备注 */
    @Excel(name = "备注")
    @ApiModelProperty("备注")
    private String remake;

    public<T> QueryWrapper<T> queryWrapper(){
        QueryWrapper<T> queryWrapper=new QueryWrapper<>();
        queryWrapper.like(StringUtils.isNotEmpty(userId),"user_id",userId);
        queryWrapper.like(StringUtils.isNotEmpty(certificatePath),"certificate_path",certificatePath);
        queryWrapper.like(StringUtils.isNotEmpty(address),"address",address);
        queryWrapper.like(StringUtils.isNotEmpty(addressDetail),"address_detail",addressDetail);
        queryWrapper.like(StringUtils.isNotEmpty(realName),"real_name",realName);
        queryWrapper.like(StringUtils.isNotEmpty(number),"number",number);
        queryWrapper.eq(StringUtils.isNotNull(status),"status",status);
        queryWrapper.eq(StringUtils.isNotNull(type),"type",type);
        queryWrapper.like(StringUtils.isNotEmpty(remake),"remake",remake);
        queryWrapper.orderByDesc("create_time");
        return queryWrapper;
    }
}